import requests
from util.proxies import get_proxies

# 'http://d4193409972:njyzbgtb@180.97.254.109:30233/'

proxies=get_proxies()
# proxies = {
#     "http": 'http://d4193409972:njyzbgtb@180.97.254.109:30233/',
#     "https": 'http://d4193409972:njyzbgtb@180.97.254.109:30233/'
#
# }

i = 0
while True:
    try:
        res = requests.get(f"https://httpbin.org/get?age={i}", proxies=proxies)
        print(res.status_code)

        i += 1
        if i == 10:
            break
    except requests.exceptions.ProxyError as e:
        print(f"代理异常", e)

        proxies = get_proxies()
    except Exception as e:
        print(e, "未知错误")
        pass
    else:
        print(res.json())
